package com.xsyz.reviewjwt.controller;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.Arrays;

/**
 * @author xsyz
 * @created 2020-12-30   15:40
 */
@RestController
public class Test {

    @GetMapping("test")
    public String test1(String name, HttpServletRequest httpServletRequest){
        httpServletRequest.getSession().setAttribute("name",name);
        ArrayList<Object> list = new ArrayList<>();
        list.add(httpServletRequest.getRequestURL());
        list.add(httpServletRequest.getCookies());
        Cookie[] cookies = httpServletRequest.getCookies();
        System.out.println(Arrays.toString(cookies));

        //System.out.println(list);
        return "success";
    }
}
